import request from "../../utils/request";

// 查询商户列表
export function getBusinessList(query) {
  return request({
    url: '/business/business/businessList',
    method: 'get',
    params: query,
  })
}

// 获取商户信息
export function getBusMsg(id) {
  return request({
    url: '/business/business/getBusMsg/' + id,
    method: 'get',
  })
}

//  修改状态
export function upStatus(query) {
  return request({
    url: 'business/business/check',
    method: 'post',
    data: query,

  })
}

export function businessType() {
  return request({
    url: '/business/business/typeList',
    method: 'get',
  })
}

export function saveBusiness(data) {
  return request({
    method: 'post',
    url: 'business/business/saveOrUpdateBusiness',
    data: data
  })
}

export function auploadHead(file, fileObj) {
  return request({
    url: '/business/business/uploadHead',
    method: 'post',
    data: file,
    headers: {'Content-Type': 'multipart/form-data'},
    onUploadProgress: progressEvent => {
      const complete = (progressEvent.loaded / progressEvent.total * 100 | 0)
      fileObj.onProgress({percent: complete}) //  调用upload组件的onprogress
    }
  })
}
